package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.GoodsOption;
import com.weipai.springboot.module.dao.GoodsOptionDao;
import com.weipai.springboot.module.mapper.GoodsOptionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: 曹朋飞
 * @Date: 2018/08/25 11:40
 */
@Repository
public class GoodsOptionDaoImpl implements GoodsOptionDao{
    
    @Autowired
    GoodsOptionMapper goodsOptionMapper;
    
    //批量保存
    @Override
    public void save(List<GoodsOption> optionList) {
        int size01 = optionList.size();
        for(int i=0;i<size01;i++){
            goodsOptionMapper.insert(optionList.get(i));
        }
    }

    //根据属性选项值查出有多少个关联数据
    @Override
    public Integer getGoodsOptionByOptionId(String optionId) {
        return goodsOptionMapper.getGoodsOptionByOptionId(optionId);
    }
}
